<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<meta http-equiv="Content-Type" content="text/html">

		<meta content="名榜" http-equiv="keywords">
		<meta name="description" content="名榜,wangid">
		<meta name="viewport" content="width=device-width,user-scalable=no, initial-scale=1">
		<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
		<title>找回密码</title>
		<!-- css -->
		<link rel="stylesheet" type="text/css" href="../../../common/css/login/index.css">
		<!-- js -->
		<script type="text/javascript" src="../../../common/js/jquery.js"></script>
		<script type="text/javascript" src="../../../common/js/public.js"></script>
		<style type="text/css">
			.tel_sp {
				color: #0092C9 !important;
			}
			
			.err {
				color: red !important;
			}
			
			.btn-success {
				width: 160px !important;
				background: url(../../../common/img/zjt/btn_bg.jpg) !important;
				color: #FFFFFF !important;
				border-radius: 5px !important;
				text-align: center;
			}
		</style>

		<script type="text/javascript">
			$(document).ready(function() {

			
						
						$("#tel").on("blur", function() {

								var $this = $(this);
								var tel = $this.val();
								var keeppwd = $("#pwdkeep").val();
								var checktel = /^[1][3,4,5,7,8][0-9]{9}$/;
								if(checktel.test(tel)) {
									$(".tel_sp").text("手机号合法").removeClass("error-border");
//									alert("ajax");
									$.ajax({
											type: "POST",
											url: "/regiest/check?flag=check",
											data: {
												"tel": tel
											},
											success: function(msg) {
												if(msg == "suc") {
													$(".tel_sp").text("手机号不存在");
												} else {

													$(".tel_sp").text("账号找回");
													document.getElementById("btnSave").removeAttribute("disabled");

										document.getElementById("getVCode").removeAttribute("disabled");
												}

											}
											});
//											alert("ajax结束");
											
									}
									else {
										$(".tel_sp").text("手机号非法").addClass("error-border");
										document.getElementById("btn").disabled = false;
										document.getElementById("btnSave").setAttribute("disabled", true);
										document.getElementById("getVCode").setAttribute("disabled", true);
										return false;

									}
								})

							

						})
		</script>

	</head>

	<body>
		<div class="top_box">
			<div class="wid_con">
				<div class="top_con">
					<div class="top_logo">
						<a href="javascript:;">
							<img src="../../../common/img/zjt/logo_big.png">
						</a>
						<span>找回密码/Password</span>
					</div>
					<div class="top_menu">
						<ul>
							<li>
								<a href="">新 闻</a>
							</li>
							<li class="cur">
								<a href="">电 影</a>
							</li>
							<li>
								<a href="">热 门</a>
							</li>
							<li>
								<a href="">视 频</a>
							</li>
							<li>
								<a href="">头 条</a>
							</li>
							<li>
								<a href="">搞 笑</a>
							</li>
						</ul>
						<i></i>
					</div>
				</div>
			</div>
		</div>
		<div class="content">
			<div class="wid_con loginbox">
				<form action="/find/submit" method="post">

					<div class="password_con">
						<div class="text_box">
							<div>

								<div><i><img src="../../../common/img/zjt/icon01.png"></i><input type="text" id="tel" placeholder="请输入您的手机号码">
									<span>*</span>
									<span class="tel_sp"></span>
								</div>
								<div class="yzm">
									<i><img src="../../../common/img/zjt/icon03.png"></i><input type="text" id="telyzm" name="telyzm" placeholder="请输入验证码">
									<input id="getVCode" type="button" disabled="true" class="btn btn-success" value="获取验证码" onclick="sendCode(this)">
									<span>*</span>
									<span class="yz_sp">${error}</span>
								</div>
								<button id="btnSave" disabled="true">下 一 步</button>

							</div>
						</div>
					</div>
				</form>
				<div class="password_txt">
					<div>
						<h1>温馨提示</h1>
						<p>提交找回密码后, 我们会将您的密码发送至您注册时所填写的邮箱，请您注意查看</p>
					</div>
					<h2>若想起密码，请点此<a href="/login/index">登录</a></h2>
				</div>
			</div>
		</div>
		<!-- footer -->
		<div class="footer">
			<p>版权所有北京微梦创科网络技术有限公司&nbsp;&nbsp;&nbsp;&nbsp;</p>
			<p>
				<a>京网文[2017]10291-1172号</a>京ICP备12002058号</p>
		</div>
	</body>
	<script type="text/javascript">
		var clock = '';
		var nums = 30;
		var btn;

		function sendCode(thisBtn) {
			btn = thisBtn;
			btn.disabled = true; //将按钮置为不可点击
			btn.value = '重新获取（' + nums + '）';
			clock = setInterval(doLoop, 1000); //一秒执行一次
		}

		function doLoop() {
			nums--;
			var tel = $("#tel").val();
			if(nums == 29) {
//				alert(tel);
				$.ajax({
					type: "POST",
					url: "/find/send?flag=yzm",
					data: {
						"tel": tel
					},

				});

			}

			if(nums > 0) {
				btn.value = '重新获取（' + nums + '）';
			} else {
				clearInterval(clock); //清除js定时器
				btn.disabled = false;
				btn.value = '点击发送验证码';
				nums = 30; //重置时间
			}
		}
	</script>

</html>